<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Ringer博客 - 重置密码</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="stylesheet" href="/static/home/css/layui.css"  media="all">
    <link rel="shortcut icon" href="favicon.ico"> <link href="/static/home/css/bootstrap.min14ed.css" rel="stylesheet">
    <link href="/static/home/css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="/static/home/css/custom.css" rel="stylesheet">
    <link href="/static/home/css/animate.min.css" rel="stylesheet">
    <link href="/static/home/css/style.min862f.css" rel="stylesheet">
    <script  src="/static/home/js/jquery.min.js"></script>
    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
</head>
<body class="gray-bg">
<div class="middle-box text-center loginscreen   animated fadeInDown">
    <div>
        <form id="resetpwd" class="m-t" role="form" action="">
            <div class="form-group">
                <input type="text" name="user_name" id="username"  class="form-control" placeholder="请输入用户名(手机号/邮箱)" required="" oninvalid="setCustomValidity('请输入用户名！');" oninput="setCustomValidity('');">
            </div>
            <div class="form-group">
                <input type="text" name="captcha" id="captcha" style="width: 200px;float: left;" class="form-control" placeholder="请输入图形验证码" required="" oninvalid="setCustomValidity('请输入图形验证码！');" oninput="setCustomValidity('');">
                <img id="captcha_img" style="width: 96px;  cursor:pointer; margin-left: 4px; border-radius: 3px; height: 32px; border: 1px solid #1ab394; background-color: #F5F5F5;" title="点击刷新" src="static/picture/captcha.html" align="absbottom" onclick="this.src='https://www.chenxuhou.com/captcha.html?'+Math.random();"></img>
            </div>
            <div class="form-group">
                <input type="text" name="code" id="code" style="width: 200px;display: inline-block;" class="form-control" placeholder="请输入短信/邮件验证码" required="" oninvalid="setCustomValidity('请输入短信/邮件验证码！');" oninput="setCustomValidity('');">
                <button id="verification" style="height: 32px;margin-top: -4px; border: 1px solid #1ab394; background-color: #F5F5F5;" type="button" class="btn">获取验证码</button>
            </div>

            <button type="submit" class="btn btn-primary block full-width m-b">确 认</button>

            <p class="text-muted text-center"><small>已经有账户了？</small><a href="https://www.chenxuhou.com/login.html">点此登录</a>
            </p>
            <input type="hidden" name="_token" value="f30UbICMHz694lBa375eiWVLUvZwT4KxzEu2xJom">
        </form>
    </div>
</div>
<script src="/static/home/js/jquery.min.js"></script>
<script src="/static/home/js/bootstrap.min.js"></script>
<script src="/static/home/js/icheck.min.js"></script>
<script src="/static/home/js/layui.js" charset="utf-8"></script>
<script src="/static/home/js/custom.js"></script>
<script>

    $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
    layui.use(['layer'], function() {

        $("#resetpwd").submit(function () {

            var data=$("#resetpwd").serialize();
            var url="https://www.chenxuhou.com/resetpwd.html";
            data=ajax(url,data);
            if(data.status == 'success') {
                if(data.msg!=''){
                    layer.msg(data.msg,{icon: 6,offset: '5px'});
                }

                if(data.redirect) {
                    setTimeout(function() {
                        location.href = data.redirect;
                    }, 1500);
                }

            } else {
                layer.msg(data.msg,{icon: 5,offset: '5px'});
                $("#captcha_img").trigger("click");
                $('#captcha').val('');
                if(data.redirect) {
                    setTimeout(function() {
                        location.href = data.redirect;
                    }, 1500);
                }
            }


            return false;
        });

        /*验证码*/
        $("#verification").on('click', function () {
            var myreg_phone = /^1[34578]{1}\d{9}$/;
            var myreg_email =  /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
            var username = $('#username').val();
            if (myreg_phone.test(username)||myreg_email.test(username)) {
                if (!$('#captcha').val()){
                    layer.msg('请输入图形验证码', {icon: 5,offset: '5px'});
                    return false;
                }

                var data=$("#resetpwd").serialize();
                var url="https://www.chenxuhou.com/verification.html?type=1";
                data=ajax(url,data);
                console.log(data);
                if(data.status == 'success') {
                    if(data.msg!=''){
                        layer.msg(data.msg,{icon: 6,offset: '5px'});
                    }

                    if(data.redirect) {
                        setTimeout(function() {
                            location.href = data.redirect;
                        }, 1500);
                    }

                } else {
                    layer.msg(data.msg,{icon: 5,offset: '5px'});
                    $("#captcha_img").trigger("click");
                    $('#captcha').val('');
                    if(data.redirect) {
                        setTimeout(function() {
                            location.href = data.redirect;
                        }, 1500);
                    }
                }
            }else {
                layer.msg('请输入正确的手机号或邮箱', {icon: 5,offset: '5px'});
                return false;
            }
        })
    });


</script>
</body>


</html>
